import React from 'react'
import { useDispatch, useSelector } from 'react-redux'
import {getMovieList} from '../../store/slice/movieSlice'
export default function Movie() {
  const dispatch = useDispatch()
  const count = useSelector(state => state.count.count)
  const movieList = useSelector(state => state.movie.movieList)
  const getMovieListHandle = () => {
    dispatch(getMovieList())
  }
  return (
    <div>
      <hr />
      <p>如果count增加我也跟着增加{count}</p>
      <p>电影的数量{movieList.length}</p>
      <button onClick={getMovieListHandle}>获取电影的数据</button>
      <ul>
        {
          movieList.map(item => {
            return <li key={item.tvId}>{item.albumName}</li>
          })
        }
      </ul>
    </div>
  )
}
